import request from './request'

/**
 * 获取所有系统配置
 */
export const getSysConfigList = () => {
  return request({
    url: '/sys-config/list',
    method: 'get'
  })
}

/**
 * 根据配置键查询
 */
export const getSysConfigByKey = (configKey) => {
  return request({
    url: `/sys-config/key/${configKey}`,
    method: 'get'
  })
}

/**
 * 创建配置
 */
export const createSysConfig = (data) => {
  return request({
    url: '/sys-config/create',
    method: 'post',
    data
  })
}

/**
 * 更新配置
 */
export const updateSysConfig = (data) => {
  return request({
    url: '/sys-config/update',
    method: 'put',
    data
  })
}

/**
 * 批量更新配置
 */
export const batchUpdateSysConfig = (data) => {
  return request({
    url: '/sys-config/batch-update',
    method: 'put',
    data
  })
}

/**
 * 删除配置
 */
export const deleteSysConfig = (id) => {
  return request({
    url: `/sys-config/${id}`,
    method: 'delete'
  })
}

